<!--资保金余额查询-->
<template>
  <div>
    <f-search-form :more='true' @searchHandler='searchHandler' :tableObj='$refs.table'>
      <f-search-form-item label='业务员' name='saleManName' />
      <f-search-form-item label='开始日期' type='date' name='beginDate' />
      <f-search-form-item label='结束日期' type='date' name='endDate' />
    </f-search-form>
    <f-table ref='table' rowKey='saleManBalanceId' :columns='columns' :scroll='{x:true}' :multiple='false' :operator='operator' :params='queryParam' :api='api.bsmb' handler='saleBalanceTab1PageListHandler'>
      <span slot='fileList' slot-scope='text, record, index'>
        <f-images :value='record.fileList'></f-images>
      </span>
      <span slot='paymentState' slot-scope='text, record, index'>
            <a-tag color='pink' v-if='text==0'>未认款</a-tag>
            <a-tag color='#87d068' v-if='text==1' @click='processImg(record)'>{{ record.taskName }}</a-tag>
            <a-tag color='#87d068' v-if='text==2'>已认款</a-tag>
      </span>
      <span slot='action' slot-scope='text, record'>
          <template>
             <a @click='$refs.dikouDetailsDrawer.showDrawer(record)'>抵扣记录</a>
          </template>

        </span>
    </f-table>
    <dikou-details-drawer ref='dikouDetailsDrawer'></dikou-details-drawer>
  </div>
</template>
<script>
import api from "../../js/api"
import DikouDetailsDrawer from "@/views/module/haiying/salemanbalance/components/dikou_details_drawer"

export default {
  name: "Tab1",
  components: {
    DikouDetailsDrawer
  },
  data() {
    let me = this
    //操作按钮
    let operator = []
    return {
      api: Object.assign(api, this.api),
      processImageVisible: false,
      //列表初始化查询参数
      queryParam: {},
      // 表头
      columns: [
        {
          title: "序号",
          width: "60px",
          align: "center",
          customRender: (text, record, index) => index + 1
        },
        {
          title: "部门",
          align: "center",
          width: "100px",
          ellipsis: true,
          dataIndex: "deptName"
        },
        {
          title: "业务员",
          align: "center",
          width: "100px",
          ellipsis: true,
          dataIndex: "saleManName"
        },
        {
          title: "收款金额",
          align: "center",
          width: "100px",
          dataIndex: "amount"
        },
        {
          title: "剩余金额",
          align: "center",
          width: "100px",
          dataIndex: "surplusAmount"
        },
        {
          title: "收款日期",
          align: "center",
          width: "120px",
          dataIndex: "amountDate"
        },

        {
          title: "收款银行",
          align: "center",
          width: "150px",
          ellipsis: true,
          dataIndex: "bankName"
        },
        {
          title: "附件",
          align: "center",
          width: "80px",
          dataIndex: "fileList",
          scopedSlots: { customRender: "fileList" }
        },
        {
          title: "制单人",
          align: "center",
          width: "120px",
          dataIndex: "nickName"
        },
        {
          title: "创建日期",
          align: "center",
          width: "150px",
          dataIndex: "createTime"
        },
        {
          title: "操作",
          align: "center",
          dataIndex: "action",
          width: "140px",
          scopedSlots: { customRender: "action" }
        }
      ],
      operator: operator
    }
  },
  created() {
  },
  methods: {
    onLoad() {
      this.$refs.table.refresh()
    },
    //重新提交
    completeTask(deposit) {
      this.http.confirm(this, {
        content: "确认提交审批吗?",
        url: api.tasktodo.complete,
        requestBody: true,
        data: {
          taskId: deposit.taskId
        },
        success: function(me, data) {
          me.$refs.table.refresh()
        }
      })
    },
    //打印退款单
    printPayment(record) {
      this.$refs["printModal"].open(record.depositId, 2, "Other")
    }
  }
}
</script>
